package com.ruoyi.project.ysgj.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.ysgj.domain.XtFxmxSjxwgx;
import com.ruoyi.project.ysgj.service.IXtFxmxSjxwgxService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;

/**
 * 数据分类模型关系Controller
 * 
 * @author 菜心
 * @date 2020-07-31
 */
@RestController
@RequestMapping("/ysgj/sjxwgx")
public class XtFxmxSjxwgxController extends BaseController
{
    @Autowired
    private IXtFxmxSjxwgxService xtFxmxSjxwgxService;

    /**
     * 查询数据分类模型关系列表
     */
    @PreAuthorize("@ss.hasPermi('ysgj:sjxwgx:list')")
    @GetMapping("/list")
    public AjaxResult list(XtFxmxSjxwgx xtFxmxSjxwgx)
    {
        List<XtFxmxSjxwgx> list = xtFxmxSjxwgxService.selectXtFxmxSjxwgxList(xtFxmxSjxwgx);
        return AjaxResult.success(list);
    }

    /**
     * 导出数据分类模型关系列表
     */
    @PreAuthorize("@ss.hasPermi('ysgj:sjxwgx:export')")
    @Log(title = "数据分类模型关系", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(XtFxmxSjxwgx xtFxmxSjxwgx)
    {
        List<XtFxmxSjxwgx> list = xtFxmxSjxwgxService.selectXtFxmxSjxwgxList(xtFxmxSjxwgx);
        ExcelUtil<XtFxmxSjxwgx> util = new ExcelUtil<XtFxmxSjxwgx>(XtFxmxSjxwgx.class);
        return util.exportExcel(list, "sjxwgx");
    }

    /**
     * 获取数据分类模型关系详细信息
     */
    @PreAuthorize("@ss.hasPermi('ysgj:sjxwgx:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(xtFxmxSjxwgxService.selectXtFxmxSjxwgxById(id));
    }

    /**
     * 新增数据分类模型关系
     */
    @PreAuthorize("@ss.hasPermi('ysgj:sjxwgx:add')")
    @Log(title = "数据分类模型关系", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody XtFxmxSjxwgx xtFxmxSjxwgx)
    {
        return toAjax(xtFxmxSjxwgxService.insertXtFxmxSjxwgx(xtFxmxSjxwgx));
    }

    /**
     * 修改数据分类模型关系
     */
    @PreAuthorize("@ss.hasPermi('ysgj:sjxwgx:edit')")
    @Log(title = "数据分类模型关系", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody XtFxmxSjxwgx xtFxmxSjxwgx)
    {
        return toAjax(xtFxmxSjxwgxService.updateXtFxmxSjxwgx(xtFxmxSjxwgx));
    }

    /**
     * 删除数据分类模型关系
     */
    @PreAuthorize("@ss.hasPermi('ysgj:sjxwgx:remove')")
    @Log(title = "数据分类模型关系", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(xtFxmxSjxwgxService.deleteXtFxmxSjxwgxByIds(ids));
    }
}
